package com.yyh.javase1;

import java.math.BigInteger;

public class BigInteger01 {
    public static void main(String[] args) {
        BigInteger bg1 = new BigInteger("100000000000000000000000000");
        BigInteger bg2 = new BigInteger("2");
        BigInteger bg3 = new BigInteger("-3");
        //取绝对值
        String abs = bg3.abs().toString();
        System.out.println("abs = " + abs);
        //加法运算
        String result = bg1.add(bg2).toString();
        System.out.println("result = " + result);
        //减法运算
        result = bg1.subtract(bg2).toString();
        System.out.println("result = " + result);
        //乘法运算
        result = bg1.multiply(bg2).toString();
        System.out.println("result = " + result);
        //除法运算
        result = bg1.divide(bg2).toString();
        System.out.println("result = " + result);
        //取余运算
        result = bg1.remainder(bg2).toString();
        System.out.println("result = " + result);
        //取模运算
        result = bg1.remainder(bg2).toString();
        System.out.println("result = " + result);
        //余和模一起运算
        BigInteger[] result1 = bg1.divideAndRemainder(bg2);
        System.out.println("result1[0] = " + result1[0]);
        System.out.println("result1[1] = " + result1[1]);


    }
}
